// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

// -------------------------------------------------------
// Validate an E-mailaddress using regular expression
// returns true if ok, false if not
// Should be used in onSubmit event of form for example.
// -------------------------------------------------------
function validateEmail(field)
{
  //Validating the email field
   var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
   if (! field.value.match(re) ) {
       alert("Invalid email address");
       field.focus();
       field.select();
       return (false);
   }
   return(true);
}